home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / pbmpl91d.zip / PBMPLUS / MAN / LIBPGM.MAN < prev    next >
Text File  |  1993-01-08  |  4KB  |  142 lines

  1.  
  2.  
  3. libpgm(3)                  Unix Programmer's Manual                  libpgm(3)
  4.  
  5.  
  6. NAME
  7.      libpgm - functions to support portable graymap programs
  8.  
  9. SYNOPSIS
  10.  
  11.      #include <pgm.h>
  12.      cc ... libpgm.a libpbm.a
  13.  
  14.  
  15. DESCRIPTION
  16.  
  17.      TYPES AND CONSTANTS
  18.  
  19.      typedef ... gray;
  20.      #define PGM_MAXMAXVAL ...
  21.      extern gray pgm_pbmmaxval;
  22.  
  23.      Each gray should contain only the values  between  0  and  PGM_MAXMAXVAL.
  24.                                                                    -
  25.      pgm_pbmmaxval  is  the  maxval  used when a PGM program reads a PBM file.
  26.         -
  27.      Normally it is 1; however, for some programs, a larger value gives better
  28.      results.
  29.  
  30.      #define PGM_FORMAT ...
  31.      #define RPGM_FORMAT ...
  32.      #define PGM_TYPE PGM_FORMAT
  33.      int PGM_FORMAT_TYPE( int format )
  34.  
  35.      For distinguishing different file formats and types.
  36.  
  37.      INITIALIZATION
  38.  
  39.      void pgm_init( int* argcP, char* argv[] )
  40.  
  41.      All PGM programs must call this routine.
  42.  
  43.      MEMORY MANAGEMENT
  44.  
  45.      gray** pgm_allocarray( int cols, int rows )
  46.  
  47.      Allocate an array of grays.
  48.  
  49.      gray* pgm_allocrow( int cols )
  50.               -
  51.  
  52.      Allocate a row of the given number of grays.
  53.  
  54.      void pgm_freearray( gray** grays, int rows )
  55.              -
  56.  
  57.      Free the array  allocated  with  pgm_allocarray()  containing  the  given
  58.                                          -
  59.      number of rows.
  60.  
  61.      void pgm_freerow( gray* grayrow )
  62.  
  63.      Free a row of grays.
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                                                                              1
  70.  
  71.  
  72.  
  73. libpgm(3)                  Unix Programmer's Manual                  libpgm(3)
  74.  
  75.  
  76.      READING FILES
  77.  
  78.      void pgm_readpgminit( FILE* fp, int* colsP, int*  rowsP,  gray*  maxvalP,
  79.      int* formatP )
  80.  
  81.      Read the header from a PGM file, filling in the rows,  cols,  maxval  and
  82.      format variables.
  83.  
  84.      void pgm_readpgmrow( FILE* fp, gray* grayrow, int cols, gray maxval,  int
  85.              -
  86.      format )
  87.  
  88.      Read a row of grays into the grayrow array.   Format,  cols,  and  maxval
  89.      were filled in by pgm_readpgminit().
  90.                           -
  91.  
  92.      gray** pgm_readpgm( FILE* fp, int* colsP, int* rowsP, gray* maxvalP )
  93.  
  94.      Read an entire graymap file into memory, returning  the  allocated  array
  95.      and  filling  in  the  rows,  cols  and  maxval variables.  This function
  96.      combines pgm_readpgminit(), pgm_allocarray() and pgm_readpgmrow().
  97.                  -                  -                    -
  98.  
  99.      WRITING FILES
  100.  
  101.      void pgm_writepgminit( FILE* fp, int cols, int  rows,  gray  maxval,  int
  102.      forceplain )
  103.  
  104.      Write the header for a portable graymap file.  The forceplain flag forces
  105.      a plain-format file to be written, as opposed to a raw-format one.
  106.  
  107.      void pgm_writepgmrow( FILE* fp, gray* grayrow, int cols, gray maxval, int
  108.              -
  109.      forceplain )
  110.  
  111.      Write a row from a portable graymap.
  112.  
  113.      void pgm_writepgm( FILE* fp, gray**  grays,  int  cols,  int  rows,  gray
  114.              -
  115.      maxval, int forceplain )
  116.  
  117.      Write the header and all data for  a  portable  graymap.   This  function
  118.      combines pgm_writepgminit() and pgm_writepgmrow().
  119.                  -                      -
  120.  
  121. SEE ALSO
  122.      libpbm(3), libppm(3), libpnm(3)
  123.  
  124. AUTHOR
  125.      Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.                                                                              2
  141.  
  142.